It is possible that only explicit plural forms are specified, and
therefore, it is possible that none match. However, handling of
explicit forms came after the count( $forms ) check, so input such
as {{PLURAL:|1=}} would trigger a "PHP Notice: Undefined offset: -1".
Change-Id: I8494de8ceb9e0cfff7203c69c21f02b3731275af
Follows-Up: I50eb0c6d1c02ca936848d310de625ed1fe43d91a
strings will now start with digits 0 and 8-f as often as they should.
* (bug 45371) Removed Parser_LinkHooks and CoreLinkFunctions classes.
* (bug 41545) Allow <kbd>, <samp>, and <var> to be nested like allowed in html.
+* PLURAL magic word no longer causes a PHP notice when no matching form exists.
=== API changes in 1.22 ===
* (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
* @return string Correct form of plural for $count in this language
*/
function convertPlural( $count, $forms ) {
- if ( !count( $forms ) ) {
- return '';
- }
-
// Handle explicit n=pluralform cases
foreach ( $forms as $index => $form ) {
if ( preg_match( '/\d+=/i', $form ) ) {
unset( $forms[$index] );
}
}
+
$forms = array_values( $forms );
+ if ( !count( $forms ) ) {
+ return '';
+ }
$pluralForm = $this->getPluralRuleIndexNumber( $count );
$pluralForm = min( $pluralForm, count( $forms ) - 1 );
array( 'other', 2, array(
'kissa=kala', '1=2=3', 'other',
) ),
+ array( '', 2, array(
+ '0=explicit zero', '1=explicit one',
+ ) ),
);
}